package com.wabi.frame.components;

import java.awt.Color;

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

import com.wabi.action.AboutAction;
import com.wabi.action.SettingsTabActionListener;

public class SettingsTab extends JPanel {

	private JButton startButton;
	private JButton aboutButton;
	private JTextField passengerInput;

	public SettingsTab(){
		GroupLayout layout = new GroupLayout(this);
		this.setLayout(layout);
		JLabel filler = new JLabel("Passengers");
		filler.setHorizontalAlignment(SwingConstants.LEFT);
		
		SettingsTabActionListener listener = new SettingsTabActionListener();
		AboutAction abAct = new AboutAction();
		passengerInput = new JTextField();
		startButton = new JButton();
		aboutButton = new JButton();

		startButton.setText("Start");
		startButton.setActionCommand("START");
		startButton.addActionListener(listener);
		
		
		aboutButton.setAction(abAct);
		aboutButton.setText("About");
		
		this.setBackground(new Color(255,255,255));
		this.add(filler);
		this.add(passengerInput);
		this.add(startButton);
		this.add(aboutButton);

		startButton.setSize(120, 100);
		aboutButton.setSize(120, 100);

		layout.setHorizontalGroup(
				layout.createSequentialGroup()
				.addGap(10)
				.addComponent(filler)
				.addGap(5)
				.addComponent(passengerInput)
				.addGap(100)
				.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addComponent(startButton)
						.addComponent(aboutButton))
						.addGap(20)
		);
		layout.setVerticalGroup(
				layout.createSequentialGroup()
				.addGap(10)
				.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
						.addComponent(filler)
						.addComponent(passengerInput)
				)
				.addGap(200)
				.addComponent(startButton)
				.addGap(10)
				.addComponent(aboutButton)
		);


	}

	public JButton getStartButton() {
		return startButton;
	}

	public JButton getAboutButton() {
		return aboutButton;
	}

	public JTextField getPassengerInput() {
		return passengerInput;
	}
}
